package com.wps.wdztv6.domain.preview;


import com.alibaba.fastjson2.annotation.JSONField;
import com.wps.wdztv6.domain.WdztResult;
import lombok.*;

@Data
@Builder
@EqualsAndHashCode
public class FileInfoCallback extends WdztResult {

    @JSONField(name = "file")

    private File file;

    @JSONField(name = "user")
    private User user;

    @Getter
    @Setter
    @ToString
    @Builder
    public static class File {
        //文件 id,字符串长度小于 32
        @JSONField(name = "id")
        private String id;
        //文件名(必须带文件后缀) example.doc
        @JSONField(name = "name")
        private String name;
        //当前版本号，位数小于 11
        @JSONField(name = "version")
        private int version;
        //文件大小，单位为 B(文件真实大小，否则会出 现异常)
        @JSONField(name = "size")
        private long size;
        //创建者 id，字符串长度小于 32
        @JSONField(name = "creator")
        private String creator;
        //创建时间，时间戳，单位为秒
        @JSONField(name = "create_time")
        private long createTime;
        //修改者 id，字符串长度小于 32
        @JSONField(name = "modifier")
        private String modifier;
        //修改时间，时间戳，单位为秒
        @JSONField(name = "modify_time")
        private long modifyTime;
        //文 档下载地址
        @JSONField(name = "download_url")
        private String downloadUrl;
        //限制预览页数 为0表示不限制
        @JSONField(name = "preview_pages")
        private int preview_pages;
        //预览时相关文件操作权限
        @JSONField(name = "user_acl")
        private UserAccessControlList userAcl;
        //预览水印
        @JSONField(name = "watermark")
        private Watermark watermark;

        @Getter
        @Setter
        @ToString
        public static class UserAccessControlList {
            //重命名权限，1 为打开该权限，0 为关闭该权限，默认为 0
            @JSONField(name = "rename")
            private int rename;
            //历史版本权限，1 为打开该权限，0 为关闭该权限,默认为 1
            @JSONField(name = "history")
            private int history;
            //复制
            @JSONField(name = "copy")
            private int copy;
            //导出 PDF
            @JSONField(name = "export")
            private int export;
            //打印
            @JSONField(name = "print")
            private int print;
        }

        @Getter
        @Setter
        @ToString
        public static class Watermark {
            //水印类型， 0 为无水印； 1 为文字水印
            @JSONField(name = "type")
            private int type;
            //文字水印的文字，当 type 为 1 时此 字段必选
            @JSONField(name = "value")
            private String value;
            //水印的透明度，非必 选，有默认值
            @JSONField(name = "fillstyle")
            private String fillstyle;
            //水印的字体，非必选，有默认值
            @JSONField(name = "font")
            private String font;
            //水印的旋转度，非必选，有默认值
            @JSONField(name = "rotate")
            private Long rotate;
            //水印水平间距，非必选，有默认值
            @JSONField(name = "horizontal")
            private Long horizontal;
            //水印垂直间距，非必选，有默认值
            @JSONField(name = "vertical")
            private Long vertical;
        }

    }

    @Getter
    @Setter
    @ToString
    @Builder
    public static class User {
        //用户 id，长度小于 32
        @JSONField(name = "id")
        private String id;
        //用户名称
        @JSONField(name = "name")
        private String name;
        //用户操作权限，write：可编辑，read：预览
        @JSONField(name = "permission")
        private String permission;
        //用户头像地址
        @JSONField(name = "avatar_url")
        private String avatarUrl;
    }
}
